<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>GSoC2011SfM: D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/PCL_mapping.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">GSoC2011SfM
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">Google Summer of Code 2011: Structure from motion</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/PCL_mapping.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="preprocessor">#ifndef PCL_MAPPING_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="preprocessor">#define PCL_MAPPING_H</span>
<a name="l00004"></a>00004 <span class="preprocessor"></span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;pcl/point_types.h&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;pcl/point_cloud.h&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;opencv2/core/core.hpp&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;opencv2/features2d/features2d.hpp&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00010"></a>00010 <span class="comment">/*</span>
<a name="l00011"></a>00011 <span class="comment">type not yet taken into account:</span>
<a name="l00012"></a>00012 <span class="comment">Normal : float[ 4 ] + float[ 4 ]</span>
<a name="l00013"></a>00013 <span class="comment">PointNormal : float[ 4 ] * 3</span>
<a name="l00014"></a>00014 <span class="comment">PointWithViewpoint : float[ 4 ] + float[ 4 ]</span>
<a name="l00015"></a>00015 <span class="comment">PointXYZRGBNormal : ( same as before )</span>
<a name="l00016"></a>00016 <span class="comment">PointXYZINormal : ( same as before )</span>
<a name="l00017"></a>00017 <span class="comment">*/</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="comment">/*</span>
<a name="l00020"></a>00020 <span class="comment">cv::Matx can&#39;t be used in an union ( due to constructors )</span>
<a name="l00021"></a>00021 <span class="comment">As cv::Matx&#39;s datas are allocated in stack ( as PCL too ),</span>
<a name="l00022"></a>00022 <span class="comment">we have to find a way to use union or use bad cast like I do here:</span>
<a name="l00023"></a>00023 <span class="comment">*/</span>
<a name="l00024"></a>00024 <span class="keyword">namespace </span>OpencvSfM{
<a name="l00025"></a>00025 
<a name="l00026"></a>00026   <span class="keyword">namespace </span>mapping{
<a name="l00027"></a>00027 
<a name="l00034"></a>00034     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> OpencvType&gt;
<a name="l00035"></a>00035     <span class="keywordtype">float</span>* convert_to_float( <span class="keyword">const</span> OpencvType&amp; t )
<a name="l00036"></a>00036     {
<a name="l00037"></a>00037       CV_DbgAssert( OpencvType::cols == 1 );
<a name="l00038"></a>00038       <span class="comment">//we have to convert data:</span>
<a name="l00039"></a>00039       <span class="keywordtype">float</span>* out = <span class="keyword">new</span> <span class="keywordtype">float</span>[ OpencvType::rows ];
<a name="l00040"></a>00040       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i &lt; OpencvType::rows; ++i )
<a name="l00041"></a>00041         out[ i ] = ( <span class="keywordtype">float</span> ) t.val[ i ];
<a name="l00042"></a>00042       <span class="keywordflow">return</span> out;
<a name="l00043"></a>00043     }
<a name="l00050"></a>00050     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type&gt;
<a name="l00051"></a>00051     Type* convert_to_( <span class="keyword">const</span> <span class="keywordtype">float</span>* data, <span class="keywordtype">int</span> sizeOfBuf = 8 )
<a name="l00052"></a>00052     {
<a name="l00053"></a>00053       <span class="comment">//we have to convert data:</span>
<a name="l00054"></a>00054       Type* out = <span class="keyword">new</span> Type[ sizeOfBuf ];
<a name="l00055"></a>00055       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i &lt; sizeOfBuf; ++i )
<a name="l00056"></a>00056         out[ i ] = ( Type ) data[ i ];
<a name="l00057"></a>00057       <span class="keywordflow">return</span> out;
<a name="l00058"></a>00058     }
<a name="l00068"></a>00068     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type, <span class="keyword">typename</span> Map_type&gt;
<a name="l00069"></a>00069     <span class="keyword">inline</span> Type* convert_without_cast( Map_type* mapped )
<a name="l00070"></a>00070     {
<a name="l00071"></a>00071       CV_DbgAssert( mapped-&gt;size_of_data &gt;= <span class="keyword">sizeof</span>( Type ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00072"></a>00072       <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span> Type* <span class="keyword">&gt;</span>( mapped-&gt;data_ );
<a name="l00073"></a>00073     }
<a name="l00080"></a>00080     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Map_type&gt;
<a name="l00081"></a>00081     <span class="keyword">inline</span> <span class="keywordtype">void</span> initData( Map_type* mapped,
<a name="l00082"></a>00082       <span class="keywordtype">int</span> sizeOfBuf = 0, <span class="keywordtype">float</span> *data = NULL )
<a name="l00083"></a>00083     {
<a name="l00084"></a>00084       <span class="keywordflow">if</span>( sizeOfBuf &lt;= 0 || data == NULL )
<a name="l00085"></a>00085       {
<a name="l00086"></a>00086         <span class="keywordflow">if</span>( sizeOfBuf &lt;= 0 )
<a name="l00087"></a>00087           mapped-&gt;size_of_data = 8;
<a name="l00088"></a>00088         <span class="keywordflow">else</span>
<a name="l00089"></a>00089           mapped-&gt;size_of_data = sizeOfBuf;
<a name="l00090"></a>00090         mapped-&gt;data_ = <span class="keyword">new</span> <span class="keywordtype">float</span>[ mapped-&gt;size_of_data ];
<a name="l00091"></a>00091         mapped-&gt;should_remove=<span class="keyword">true</span>;
<a name="l00092"></a>00092       }
<a name="l00093"></a>00093       <span class="keywordflow">else</span>
<a name="l00094"></a>00094       {
<a name="l00095"></a>00095         mapped-&gt;size_of_data = ( <span class="keywordtype">unsigned</span> int ) sizeOfBuf;
<a name="l00096"></a>00096         mapped-&gt;data_ = data;
<a name="l00097"></a>00097         mapped-&gt;should_remove=<span class="keyword">false</span>;
<a name="l00098"></a>00098       }
<a name="l00099"></a>00099     }
<a name="l00105"></a>00105     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Map_type&gt;
<a name="l00106"></a>00106     <span class="keyword">inline</span> <span class="keywordtype">void</span> setDistinctMemory( Map_type* mapped,
<a name="l00107"></a>00107       <span class="keywordtype">int</span> new_mem_size = 8, <span class="keywordtype">float</span>* newData = NULL )
<a name="l00108"></a>00108     {
<a name="l00109"></a>00109       <span class="keywordtype">int</span> newSize = MAX( new_mem_size, mapped-&gt;size_of_data );
<a name="l00110"></a>00110       <span class="keywordtype">float</span>* data = newData;
<a name="l00111"></a>00111       <span class="keywordflow">if</span>( data == NULL )
<a name="l00112"></a>00112       {
<a name="l00113"></a>00113         data = <span class="keyword">new</span> <span class="keywordtype">float</span>[ newSize ];
<a name="l00114"></a>00114         memcpy( data, mapped-&gt;data_, mapped-&gt;size_of_data*<span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00115"></a>00115       }
<a name="l00116"></a>00116       <span class="keywordflow">if</span>( mapped-&gt;should_remove ) <span class="keyword">delete</span> mapped-&gt;data_;
<a name="l00117"></a>00117       mapped-&gt;should_remove = <span class="keyword">true</span>;
<a name="l00118"></a>00118       mapped-&gt;size_of_data = newSize;
<a name="l00119"></a>00119       mapped-&gt;data_ = data;
<a name="l00120"></a>00120     }
<a name="l00128"></a>00128     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> LowDataType, <span class="keyword">typename</span> Type, <span class="keyword">typename</span> Map_type&gt;
<a name="l00129"></a>00129     <span class="keyword">inline</span> <span class="keywordtype">void</span> convert_( Map_type* mapped, Type* out )
<a name="l00130"></a>00130     {
<a name="l00131"></a>00131       CV_DbgAssert( mapped-&gt;size_of_data &gt;= <span class="keyword">sizeof</span>( Type ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00132"></a>00132       LowDataType* data = convert_to_&lt;LowDataType&gt;( mapped-&gt;data_, mapped-&gt;size_of_data );
<a name="l00133"></a>00133       memcpy( reinterpret_cast&lt; char* &gt;( out ), data, <span class="keyword">sizeof</span>( Type ) );
<a name="l00134"></a>00134       <span class="keyword">delete</span> data;
<a name="l00135"></a>00135     }
<a name="l00136"></a>00136 
<a name="l00140"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html">00140</a>     <span class="keyword">struct </span>EIGEN_ALIGN16 <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html" title="This structure will handle conversions between OpenCV and PCL data.">Point</a>
<a name="l00141"></a>00141     {
<a name="l00142"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a666ff6498ab06e80cf437717b53cbedb">00142</a>       <span class="keywordtype">float</span> *<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a666ff6498ab06e80cf437717b53cbedb" title="values of datas">data_</a>;
<a name="l00143"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c">00143</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a>;
<a name="l00144"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a70bca8ffed2d642a4e24a9e944f15824">00144</a>       <span class="keywordtype">bool</span> <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a70bca8ffed2d642a4e24a9e944f15824" title="Used to know if data were allocated.">should_remove</a>;
<a name="l00145"></a>00145 
<a name="l00149"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#ae9be3bcc5a1f5ca4537de12936ba643f">00149</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#ae9be3bcc5a1f5ca4537de12936ba643f">Point</a>( <span class="keyword">const</span> <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html" title="This structure will handle conversions between OpenCV and PCL data.">Point</a>&amp; otherP ){
<a name="l00150"></a>00150         initData( <span class="keyword">this</span>, otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> );
<a name="l00151"></a>00151         memcpy( data_, otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a666ff6498ab06e80cf437717b53cbedb" title="values of datas">data_</a>, size_of_data * <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00152"></a>00152       };
<a name="l00153"></a>00153 
<a name="l00157"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#ab9e042bdce8cef0dd5ea9c0a117f716f">00157</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html" title="This structure will handle conversions between OpenCV and PCL data.">Point</a>&amp; operator =( <span class="keyword">const</span> <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html" title="This structure will handle conversions between OpenCV and PCL data.">Point</a>&amp; otherP ){
<a name="l00158"></a>00158         <span class="keywordtype">int</span> dataSize = otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> * <span class="keyword">sizeof</span>( float );
<a name="l00159"></a>00159         <span class="keywordflow">if</span>( otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> &gt; size_of_data )
<a name="l00160"></a>00160         {
<a name="l00161"></a>00161           <span class="keywordflow">if</span>( should_remove ) <span class="keyword">delete</span> data_;
<a name="l00162"></a>00162           initData( <span class="keyword">this</span>, otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> );
<a name="l00163"></a>00163         }
<a name="l00164"></a>00164         <span class="keywordflow">else</span>
<a name="l00165"></a>00165         {
<a name="l00166"></a>00166           <span class="keywordflow">if</span>( otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> &lt; size_of_data )
<a name="l00167"></a>00167           {<span class="comment">//init the range outside the copy:</span>
<a name="l00168"></a>00168             <span class="keywordtype">int</span> diff = ( size_of_data - otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6a039913d2dde14898aed0ea8472079c" title="Size of data buffer.">size_of_data</a> ) *
<a name="l00169"></a>00169               <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> );
<a name="l00170"></a>00170             dataSize = ( ( size_of_data * <span class="keyword">sizeof</span>( float ) ) - diff );
<a name="l00171"></a>00171             memset ( ( (<span class="keywordtype">char</span>* )data_ ) + dataSize, 0, diff );
<a name="l00172"></a>00172           }
<a name="l00173"></a>00173         }
<a name="l00174"></a>00174         memcpy( data_, otherP.<a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a666ff6498ab06e80cf437717b53cbedb" title="values of datas">data_</a>, dataSize );
<a name="l00175"></a>00175         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00176"></a>00176       };
<a name="l00177"></a>00177 
<a name="l00181"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a9641fe547538afc3fefb49140d47f56c">00181</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a9641fe547538afc3fefb49140d47f56c">Point</a>( ){ initData( <span class="keyword">this</span> ); };
<a name="l00182"></a>00182 
<a name="l00188"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a1e4c2461088430e787fcb23be2a2b72a">00188</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a1e4c2461088430e787fcb23be2a2b72a">Point</a>( <span class="keywordtype">float</span> *data, <span class="keywordtype">int</span> sizeOfBuf = 4 ){
<a name="l00189"></a>00189         initData( <span class="keyword">this</span>, sizeOfBuf, data );
<a name="l00190"></a>00190       };
<a name="l00191"></a>00191 
<a name="l00196"></a>00196       <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type, <span class="keywordtype">int</span> size&gt;
<a name="l00197"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#abb20fa5509e7ca84735a4231de05f8ff">00197</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#abb20fa5509e7ca84735a4231de05f8ff">Point</a>( cv::Vec&lt;Type,size&gt;&amp; v ){
<a name="l00198"></a>00198         <span class="keywordflow">if</span>( <span class="keyword">sizeof</span>( Type ) == <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) )
<a name="l00199"></a>00199           initData( <span class="keyword">this</span>, v.rows, ( <span class="keywordtype">float</span>* ) v.val );
<a name="l00200"></a>00200         <span class="keywordflow">else</span>
<a name="l00201"></a>00201         {
<a name="l00202"></a>00202           initData( <span class="keyword">this</span>, v.rows, convert_to_float( v ) );
<a name="l00203"></a>00203           should_remove=<span class="keyword">true</span>;<span class="comment">//convert_to_float create a buffer</span>
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205       };
<a name="l00206"></a>00206       
<a name="l00211"></a>00211       <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type, <span class="keywordtype">int</span> size&gt;
<a name="l00212"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a94c5017f3cdec806be1c3bdb7f331892">00212</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a94c5017f3cdec806be1c3bdb7f331892">Point</a>( cv::Matx&lt;Type,size,1&gt;&amp; matX ){
<a name="l00213"></a>00213         <span class="keywordflow">if</span>( <span class="keyword">sizeof</span>( Type::value_type ) == <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) )
<a name="l00214"></a>00214           initData( <span class="keyword">this</span>, Type::rows, ( <span class="keywordtype">float</span>* ) matX.val );
<a name="l00215"></a>00215         <span class="keywordflow">else</span>
<a name="l00216"></a>00216         {
<a name="l00217"></a>00217           initData( <span class="keyword">this</span>, Type::rows, convert_to_float( matX ) );
<a name="l00218"></a>00218           should_remove=<span class="keyword">true</span>;<span class="comment">//convert_to_float create a buffer</span>
<a name="l00219"></a>00219         }
<a name="l00220"></a>00220       };
<a name="l00221"></a>00221       
<a name="l00226"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aa36651ca14763cf958e2116ca209bd95">00226</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aa36651ca14763cf958e2116ca209bd95">Point</a>( cv::KeyPoint&amp; kp ){
<a name="l00227"></a>00227         initData( <span class="keyword">this</span>, 6, reinterpret_cast&lt; float* &gt;( &amp;kp ) );
<a name="l00228"></a>00228       };
<a name="l00229"></a>00229       
<a name="l00234"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a544a2a4bec6e1017532c92414435d0a2">00234</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a544a2a4bec6e1017532c92414435d0a2">Point</a>( pcl::PointXY&amp; pXY ){
<a name="l00235"></a>00235         initData( <span class="keyword">this</span>, 2, reinterpret_cast&lt; float* &gt;( &amp;pXY ) );
<a name="l00236"></a>00236       };
<a name="l00241"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a8dfd869655fbb53a6fcf8bb4cfd4b884">00241</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a8dfd869655fbb53a6fcf8bb4cfd4b884">Point</a>( pcl::PointXYZ&amp; pXYZ ){ initData( <span class="keyword">this</span>, 4, pXYZ.data ); };
<a name="l00246"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a473cb52fd9f90bc930d2398760f79923">00246</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a473cb52fd9f90bc930d2398760f79923">Point</a>( pcl::PointXYZI&amp; pXYZi ){ initData( <span class="keyword">this</span>, 8, pXYZi.data ); };
<a name="l00251"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aef7d484cab9cdb58dff1953564f0ac89">00251</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aef7d484cab9cdb58dff1953564f0ac89">Point</a>( pcl::InterestPoint&amp; iP ){ initData( <span class="keyword">this</span>, 8, iP.data ); };
<a name="l00256"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a23e8622b0f7e5b3ce68d059aa22055f9">00256</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a23e8622b0f7e5b3ce68d059aa22055f9">Point</a>( pcl::PointWithRange&amp; pPWR ){ initData( <span class="keyword">this</span>, 8, pPWR.data ); };
<a name="l00261"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#ab291f19a27cac4c5a0527f1fc20e6dc4">00261</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#ab291f19a27cac4c5a0527f1fc20e6dc4">Point</a>( pcl::PointXYZRGBA&amp; pXYZ1 ){ initData( <span class="keyword">this</span>, 8, pXYZ1.data ); };
<a name="l00266"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aadaadafaa9f6c4a060f68f5227c9c3eb">00266</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#aadaadafaa9f6c4a060f68f5227c9c3eb">Point</a>( pcl::PointXYZRGB&amp; pXYZ2 ){ initData( <span class="keyword">this</span>, 8, pXYZ2.data ); };
<a name="l00267"></a>00267 
<a name="l00272"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a0e66869a3894ce168a654cc2bdff0302">00272</a>       <a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a0e66869a3894ce168a654cc2bdff0302">~Point</a>( ){ <span class="keywordflow">if</span>( should_remove ) <span class="keyword">delete</span> data_; };
<a name="l00273"></a>00273 
<a name="l00274"></a>00274 
<a name="l00278"></a>00278       <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type, <span class="keywordtype">int</span> size&gt;
<a name="l00279"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a545d6da094d840f869c6dd0929456f9a">00279</a>       <span class="keyword">inline</span> operator cv::Matx&lt;Type,size,1&gt;&amp;( ) {
<a name="l00280"></a>00280         CV_DbgAssert( <span class="keyword">sizeof</span>( Type ) == <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00281"></a>00281         <span class="keywordflow">return</span> * convert_without_cast&lt; cv::Matx&lt;Type,size,1&gt; &gt;( this );
<a name="l00282"></a>00282       };
<a name="l00286"></a>00286       <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type, <span class="keywordtype">int</span> size&gt;
<a name="l00287"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a971d1c329fc6d97383b7ff46120ed9a6">00287</a>       <span class="keyword">inline</span> operator cv::Vec&lt;Type,size&gt;&amp;( ) {
<a name="l00288"></a>00288         CV_DbgAssert( <span class="keyword">sizeof</span>( Type ) == <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00289"></a>00289         <span class="keywordflow">return</span> * convert_without_cast&lt; cv::Vec&lt;Type,size&gt; &gt;( this );
<a name="l00290"></a>00290       };
<a name="l00294"></a>00294       <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type&gt;
<a name="l00295"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a6cbf0a2a66b5b1205625d7f20313a515">00295</a>       <span class="keyword">inline</span> operator cv::Point3_&lt;Type&gt;&amp;( ) {
<a name="l00296"></a>00296         CV_DbgAssert( <span class="keyword">sizeof</span>( Type ) == <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00297"></a>00297         <span class="keywordflow">return</span> * convert_without_cast&lt; cv::Point3_&lt;Type&gt; &gt;( this );
<a name="l00298"></a>00298       };
<a name="l00302"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a80abd29cb809f43e19de1d9d6578544f">00302</a>       <span class="keyword">inline</span> operator cv::KeyPoint&amp;( ) {
<a name="l00303"></a>00303       <span class="keywordflow">return</span> * convert_without_cast&lt; cv::KeyPoint &gt;( this );};
<a name="l00304"></a>00304 
<a name="l00305"></a>00305       
<a name="l00309"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a75a69b3493997c78d66be311ffd859e0">00309</a>       <span class="keyword">inline</span> operator pcl::PointXY&amp;( ) {
<a name="l00310"></a>00310         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointXY &gt;( this );
<a name="l00311"></a>00311       };
<a name="l00315"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a118df999696f086bc426da8c2e509985">00315</a>       <span class="keyword">inline</span> operator pcl::PointXYZ&amp;( ) {
<a name="l00316"></a>00316         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointXYZ &gt;( this );
<a name="l00317"></a>00317       };
<a name="l00321"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a7526edfadbdd5726fc277ba407fe6670">00321</a>       <span class="keyword">inline</span> operator pcl::PointXYZI&amp;( ) {
<a name="l00322"></a>00322         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointXYZI &gt;( this );
<a name="l00323"></a>00323       };
<a name="l00327"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a9598c13c4ffb6b06eaf79d6039b8b539">00327</a>       <span class="keyword">inline</span> operator pcl::InterestPoint&amp;( ) {
<a name="l00328"></a>00328         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::InterestPoint &gt;( this );
<a name="l00329"></a>00329       };
<a name="l00333"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a710272d5167922f4ca779be0d4d4d28c">00333</a>       <span class="keyword">inline</span> operator pcl::PointWithRange&amp;( ) {
<a name="l00334"></a>00334         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointWithRange &gt;( this );
<a name="l00335"></a>00335       };
<a name="l00339"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a2fcc649e9e3ba4cc20eef5f0438a822a">00339</a>       <span class="keyword">inline</span> operator pcl::PointXYZRGBA&amp;( ) {
<a name="l00340"></a>00340         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointXYZRGBA &gt;( this );
<a name="l00341"></a>00341       };
<a name="l00345"></a><a class="code" href="struct_opencv_sf_m_1_1mapping_1_1_point.html#a38f6d6366c6ea008c017db1752ff662b">00345</a>       <span class="keyword">inline</span> operator pcl::PointXYZRGB&amp;( ) {
<a name="l00346"></a>00346         <span class="keywordflow">return</span> * convert_without_cast&lt; pcl::PointXYZRGB &gt;( this );
<a name="l00347"></a>00347       };
<a name="l00348"></a>00348 
<a name="l00349"></a>00349 
<a name="l00350"></a>00350       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
<a name="l00351"></a>00351     };
<a name="l00352"></a>00352     
<a name="l00357"></a>00357     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> TypeTo,
<a name="l00358"></a>00358       <span class="keyword">typename</span> allocatorFrom, <span class="keyword">typename</span> allocatorTo&gt;
<a name="l00359"></a>00359     <span class="keywordtype">void</span> convertToMappedVector(
<a name="l00360"></a>00360       <span class="keyword">const</span> std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00361"></a>00361       std::vector&lt;TypeTo,allocatorTo&gt;&amp; vectTo )
<a name="l00362"></a>00362     {
<a name="l00363"></a>00363       vectTo.clear( );
<a name="l00364"></a>00364       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> it = 0,
<a name="l00365"></a>00365         end = vectFrom.size( );
<a name="l00366"></a>00366       vectTo.reserve( end );
<a name="l00367"></a>00367 
<a name="l00368"></a>00368       <span class="keywordflow">while</span> ( it &lt; end )
<a name="l00369"></a>00369       {
<a name="l00370"></a>00370         <span class="comment">//can&#39;t create directly the new value because of the const arg...</span>
<a name="l00371"></a>00371         TypeTo convertor( NULL, <span class="keyword">sizeof</span>( TypeFrom ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );
<a name="l00372"></a>00372         <span class="keyword">const</span> TypeFrom&amp; val = vectFrom[ it ];
<a name="l00373"></a>00373 
<a name="l00374"></a>00374         memcpy( reinterpret_cast&lt;char*&gt;( convertor.data_ ),
<a name="l00375"></a>00375           reinterpret_cast&lt;const char*&gt;( &amp;val ),
<a name="l00376"></a>00376           <span class="keyword">sizeof</span>( TypeFrom ) );<span class="comment">//assign the new value</span>
<a name="l00377"></a>00377 
<a name="l00378"></a>00378         vectTo.push_back( convertor );<span class="comment">//create an empty value</span>
<a name="l00379"></a>00379         it++;
<a name="l00380"></a>00380       }
<a name="l00381"></a>00381     }
<a name="l00382"></a>00382     
<a name="l00387"></a>00387     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> TypeTo,
<a name="l00388"></a>00388       <span class="keyword">typename</span> allocatorFrom, <span class="keyword">typename</span> allocatorTo&gt;
<a name="l00389"></a>00389     <span class="keywordtype">void</span> convertFromMappedVector(
<a name="l00390"></a>00390       std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00391"></a>00391       std::vector&lt;TypeTo,allocatorTo&gt;&amp; vectTo )
<a name="l00392"></a>00392     {
<a name="l00393"></a>00393       vectTo.clear( );
<a name="l00394"></a>00394       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> it = 0,
<a name="l00395"></a>00395         end = vectFrom.size( );
<a name="l00396"></a>00396       vectTo.reserve( end );
<a name="l00397"></a>00397 
<a name="l00398"></a>00398       <span class="keywordflow">while</span> ( it &lt; end )
<a name="l00399"></a>00399       {
<a name="l00400"></a>00400         vectTo.push_back( TypeTo( ) );<span class="comment">//create an empty value</span>
<a name="l00401"></a>00401         <span class="keywordtype">int</span> minSize = <span class="keyword">sizeof</span>( vectTo[ it ] ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> );
<a name="l00402"></a>00402         <span class="comment">//We must have enough space in mapped memory:</span>
<a name="l00403"></a>00403         <span class="keywordflow">if</span>( minSize &gt; vectFrom[ it ].size_of_data )
<a name="l00404"></a>00404           setDistinctMemory( &amp;vectFrom[ it ], minSize );
<a name="l00405"></a>00405 
<a name="l00406"></a>00406 
<a name="l00407"></a>00407         memcpy( reinterpret_cast&lt;char*&gt;( &amp;vectTo[ it ] ),
<a name="l00408"></a>00408           reinterpret_cast&lt;const char*&gt;( vectFrom[ it ].data_ ),
<a name="l00409"></a>00409           minSize * <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> ) );<span class="comment">//assign the new value</span>
<a name="l00410"></a>00410         it++;
<a name="l00411"></a>00411       }
<a name="l00412"></a>00412     }
<a name="l00413"></a>00413     
<a name="l00417"></a>00417     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> TypeTo,
<a name="l00418"></a>00418       <span class="keyword">typename</span> allocatorFrom, <span class="keyword">typename</span> allocatorTo&gt;
<a name="l00419"></a>00419     <span class="keywordtype">void</span> convert_OpenCV_vector(
<a name="l00420"></a>00420       <span class="keyword">const</span> std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00421"></a>00421       std::vector&lt;TypeTo,allocatorTo&gt;&amp; vectTo )
<a name="l00422"></a>00422     {
<a name="l00423"></a>00423       vectTo.clear( );
<a name="l00424"></a>00424       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> it = 0,
<a name="l00425"></a>00425         end = vectFrom.size( );
<a name="l00426"></a>00426       vectTo.reserve( end );
<a name="l00427"></a>00427 
<a name="l00428"></a>00428       <span class="keywordflow">while</span> ( it &lt; end )
<a name="l00429"></a>00429       {
<a name="l00430"></a>00430         vectTo.push_back( TypeTo( ) );<span class="comment">//create an empty value</span>
<a name="l00431"></a>00431         <span class="keywordtype">float</span>* datas = convert_to_float( vectFrom[ it ] );
<a name="l00432"></a>00432 
<a name="l00433"></a>00433         memcpy( reinterpret_cast&lt;char*&gt;( &amp;vectTo[ it ] ),
<a name="l00434"></a>00434           reinterpret_cast&lt;const char*&gt;( datas ),
<a name="l00435"></a>00435           <span class="keyword">sizeof</span>( TypeFrom ) );<span class="comment">//assign the new value</span>
<a name="l00436"></a>00436 
<a name="l00437"></a>00437         <span class="keyword">delete</span> datas;
<a name="l00438"></a>00438         it++;
<a name="l00439"></a>00439       }
<a name="l00440"></a>00440     }
<a name="l00441"></a>00441     
<a name="l00445"></a>00445     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> TypeTo,
<a name="l00446"></a>00446       <span class="keyword">typename</span> allocatorFrom, <span class="keyword">typename</span> allocatorTo&gt;
<a name="l00447"></a>00447     <span class="keywordtype">void</span> convert_PCL_vector(
<a name="l00448"></a>00448       <span class="keyword">const</span> std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00449"></a>00449       std::vector&lt;TypeTo,allocatorTo&gt;&amp; vectTo )
<a name="l00450"></a>00450     {
<a name="l00451"></a>00451       vectTo.clear( );
<a name="l00452"></a>00452       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> it = 0,
<a name="l00453"></a>00453         end = vectFrom.size( );
<a name="l00454"></a>00454       vectTo.reserve( end );
<a name="l00455"></a>00455       <span class="keywordtype">int</span> sizeOfData = <span class="keyword">sizeof</span>( TypeFrom ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> );
<a name="l00456"></a>00456 
<a name="l00457"></a>00457       <span class="keywordflow">while</span> ( it &lt; end )
<a name="l00458"></a>00458       {
<a name="l00459"></a>00459         vectTo.push_back( TypeTo( ) );<span class="comment">//create an empty value</span>
<a name="l00460"></a>00460         <span class="keyword">const</span> <span class="keywordtype">float</span>* datas = <span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">float</span>*<span class="keyword">&gt;</span>( &amp;vectFrom[ it ] );
<a name="l00461"></a>00461         <span class="keywordtype">void</span> *valConverted;
<a name="l00462"></a>00462         <span class="keywordtype">int</span> sizeOfType;
<a name="l00463"></a>00463 
<a name="l00464"></a>00464         <span class="comment">//copy data using type:</span>
<a name="l00465"></a>00465         <span class="keywordflow">switch</span>( TypeTo::depth )
<a name="l00466"></a>00466         {
<a name="l00467"></a>00467         <span class="keywordflow">case</span> CV_8U:
<a name="l00468"></a>00468           valConverted = convert_to_&lt;uchar&gt;( datas, sizeOfData );
<a name="l00469"></a>00469           sizeOfType = <span class="keyword">sizeof</span>( uchar );
<a name="l00470"></a>00470           <span class="keywordflow">break</span>;
<a name="l00471"></a>00471         <span class="keywordflow">case</span> CV_8S:
<a name="l00472"></a>00472           valConverted = convert_to_&lt;char&gt;( datas, sizeOfData );
<a name="l00473"></a>00473           sizeOfType = <span class="keyword">sizeof</span>( char );
<a name="l00474"></a>00474           <span class="keywordflow">break</span>;
<a name="l00475"></a>00475         <span class="keywordflow">case</span> CV_16U:
<a name="l00476"></a>00476           valConverted = convert_to_&lt;ushort&gt;( datas, sizeOfData );
<a name="l00477"></a>00477           sizeOfType = <span class="keyword">sizeof</span>( ushort );
<a name="l00478"></a>00478           <span class="keywordflow">break</span>;
<a name="l00479"></a>00479         <span class="keywordflow">case</span> CV_16S:
<a name="l00480"></a>00480           valConverted = convert_to_&lt;short&gt;( datas, sizeOfData );
<a name="l00481"></a>00481           sizeOfType = <span class="keyword">sizeof</span>( short );
<a name="l00482"></a>00482           <span class="keywordflow">break</span>;
<a name="l00483"></a>00483         <span class="keywordflow">case</span> CV_32S:
<a name="l00484"></a>00484           valConverted = convert_to_&lt;int&gt;( datas, sizeOfData );
<a name="l00485"></a>00485           sizeOfType = <span class="keyword">sizeof</span>( int );
<a name="l00486"></a>00486           <span class="keywordflow">break</span>;
<a name="l00487"></a>00487         <span class="keywordflow">case</span> CV_32F:
<a name="l00488"></a>00488           valConverted = convert_to_&lt;float&gt;( datas, sizeOfData );
<a name="l00489"></a>00489           sizeOfType = <span class="keyword">sizeof</span>( float );
<a name="l00490"></a>00490           <span class="keywordflow">break</span>;
<a name="l00491"></a>00491         <span class="keywordflow">case</span> CV_64F:
<a name="l00492"></a>00492           valConverted = convert_to_&lt;double&gt;( datas, sizeOfData );
<a name="l00493"></a>00493           sizeOfType = <span class="keyword">sizeof</span>( double );
<a name="l00494"></a>00494           <span class="keywordflow">break</span>;
<a name="l00495"></a>00495         <span class="keywordflow">case</span> CV_USRTYPE1:
<a name="l00496"></a>00496           CV_Error( CV_StsBadFunc, <span class="stringliteral">&quot;User type is not allowed!&quot;</span> );
<a name="l00497"></a>00497           <span class="keywordflow">break</span>;
<a name="l00498"></a>00498         }
<a name="l00499"></a>00499 
<a name="l00500"></a>00500         memcpy( reinterpret_cast&lt;char*&gt;( &amp;vectTo[ it ] ),
<a name="l00501"></a>00501           reinterpret_cast&lt;const char*&gt;( valConverted ),
<a name="l00502"></a>00502           <span class="keyword">sizeof</span>( TypeFrom ) );<span class="comment">//assign the new value</span>
<a name="l00503"></a>00503 
<a name="l00504"></a>00504         <span class="keywordflow">switch</span>( TypeTo::depth )
<a name="l00505"></a>00505         {
<a name="l00506"></a>00506         <span class="keywordflow">case</span> CV_8U:
<a name="l00507"></a>00507           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span>uchar*<span class="keyword">&gt;</span>(valConverted);
<a name="l00508"></a>00508           <span class="keywordflow">break</span>;
<a name="l00509"></a>00509         <span class="keywordflow">case</span> CV_8S:
<a name="l00510"></a>00510           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(valConverted);
<a name="l00511"></a>00511           <span class="keywordflow">break</span>;
<a name="l00512"></a>00512         <span class="keywordflow">case</span> CV_16U:
<a name="l00513"></a>00513           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span>ushort*<span class="keyword">&gt;</span>(valConverted);
<a name="l00514"></a>00514           <span class="keywordflow">break</span>;
<a name="l00515"></a>00515         <span class="keywordflow">case</span> CV_16S:
<a name="l00516"></a>00516           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">short</span>*<span class="keyword">&gt;</span>(valConverted);
<a name="l00517"></a>00517           <span class="keywordflow">break</span>;
<a name="l00518"></a>00518         <span class="keywordflow">case</span> CV_32S:
<a name="l00519"></a>00519           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">int</span>*<span class="keyword">&gt;</span>(valConverted);
<a name="l00520"></a>00520           <span class="keywordflow">break</span>;
<a name="l00521"></a>00521         <span class="keywordflow">case</span> CV_32F:
<a name="l00522"></a>00522           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>*<span class="keyword">&gt;</span>(valConverted);
<a name="l00523"></a>00523           <span class="keywordflow">break</span>;
<a name="l00524"></a>00524         <span class="keywordflow">case</span> CV_64F:
<a name="l00525"></a>00525           <span class="keyword">delete</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">double</span>*<span class="keyword">&gt;</span>(valConverted);
<a name="l00526"></a>00526           <span class="keywordflow">break</span>;
<a name="l00527"></a>00527           <span class="keywordflow">break</span>;
<a name="l00528"></a>00528         }
<a name="l00529"></a>00529         it++;
<a name="l00530"></a>00530       }
<a name="l00531"></a>00531     }
<a name="l00532"></a>00532     
<a name="l00536"></a>00536     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> allocatorFrom&gt;
<a name="l00537"></a>00537     <span class="keywordtype">void</span> convert_PCL_vector(
<a name="l00538"></a>00538       std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00539"></a>00539       cv::Mat&amp; output, <span class="keywordtype">bool</span> copyValues = <span class="keyword">false</span> )
<a name="l00540"></a>00540     {
<a name="l00541"></a>00541       <span class="comment">//PCL data are ALWAYS float, just the number of elements can change:</span>
<a name="l00542"></a>00542       <span class="keywordtype">int</span> nbCol = <span class="keyword">sizeof</span>( TypeFrom ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> );
<a name="l00543"></a>00543       output = cv::Mat( vectFrom.size( ), nbCol,
<a name="l00544"></a>00544         CV_32F, ( <span class="keywordtype">void</span>* )&amp;vectFrom[ 0 ] );
<a name="l00545"></a>00545       <span class="keywordflow">if</span>( copyValues )
<a name="l00546"></a>00546         output = output.clone( );
<a name="l00547"></a>00547     }
<a name="l00548"></a>00548     
<a name="l00552"></a>00552     <span class="keyword">template</span>&lt;<span class="keyword">typename</span> TypeFrom, <span class="keyword">typename</span> allocatorFrom,
<a name="l00553"></a>00553       <span class="keyword">typename</span> PCL_point&gt;
<a name="l00554"></a>00554     <span class="keywordtype">void</span> convert_OpenCV_vector(
<a name="l00555"></a>00555       <span class="keyword">const</span> std::vector&lt;TypeFrom,allocatorFrom&gt;&amp; vectFrom,
<a name="l00556"></a>00556       pcl::PointCloud&lt; PCL_point &gt;&amp; output )
<a name="l00557"></a>00557     {
<a name="l00558"></a>00558       <span class="keywordtype">int</span> sizeOfData = <span class="keyword">sizeof</span>( PCL_point ) / <span class="keyword">sizeof</span>( <span class="keywordtype">float</span> );
<a name="l00559"></a>00559       sizeOfData = MIN( sizeOfData, TypeFrom::rows );
<a name="l00560"></a>00560 
<a name="l00561"></a>00561       <span class="keywordtype">size_t</span> itTrack = 0,
<a name="l00562"></a>00562       max_size = vectFrom.size( );
<a name="l00563"></a>00563       <span class="keywordflow">while</span> ( itTrack &lt; max_size )
<a name="l00564"></a>00564       {
<a name="l00565"></a>00565         <span class="keywordtype">float</span>* datas = convert_to_float( vectFrom[ itTrack ] );
<a name="l00566"></a>00566         PCL_point p;
<a name="l00567"></a>00567         <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i&lt;sizeOfData; ++i )
<a name="l00568"></a>00568           p.data[ i ] = datas[ i ];
<a name="l00569"></a>00569 
<a name="l00570"></a>00570         output.points.push_back( p );
<a name="l00571"></a>00571         <span class="keyword">delete</span> datas;
<a name="l00572"></a>00572         itTrack++;
<a name="l00573"></a>00573       }
<a name="l00574"></a>00574     }
<a name="l00575"></a>00575   }
<a name="l00576"></a>00576 
<a name="l00577"></a>00577 }
<a name="l00578"></a>00578 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sun Aug 21 2011 16:45:52 for GSoC2011SfM by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
